home *** CD-ROM | disk | FTP | other *** search
/ Mac100% 1999 April / MAC100-1999-04.ISO.7z / MAC100-1999-04.ISO / オンラインソフト定点観測 / Text / FireWrite.sit / FireWrite v1.04 [Fixed] / おまけフォルダ / CreatorType Changer v1.12 / Script.txt < prev    next >
Text File  |  1999-01-01  |  2KB  |  41 lines

  1. --スクリプト言語を「AppleScript 英語」にすると快適です(僕の環境では)。
  2. --このTEXT-ttroは丸 雅宏( mmaru@geocities.co.jp )に著作権があります。
  3. --スクリプトは一部分なら真似しても構いません。真似する人がいるかどうかは別として。
  4.  
  5. --このスクリプトの使用には、システムは漢字Talk 7.5以上で、AppleScriptが使える環境でないと使えません。
  6. --(漢字Talk 7.1.2でも、AppleScriptは使えるようですが、CreatorType Changerは動きません)
  7.  
  8. on open objectList
  9.     set creatorType to "ttxt"
  10.     tell application "Finder"
  11.         repeat with repeatList in objectList
  12.             if file (repeatList as string) exists then
  13.                 try
  14.                     if file type of repeatList = "ttro" or file type of repeatList = "TEXT" then
  15.                         repeat
  16.                             --ボタン「キャンセル」は、AppleScriptの仕様上、スクリプトが終了する。
  17.                             display dialog "ファイル「" & name of repeatList & "」のクリエータタイプを決めてください。" buttons {"参照", "キャンセル", "OK"} ツ
  18.                                 default button "OK" default answer creatorType
  19.                             if button returned of the result is "参照" then
  20.                                 choose file with prompt "クリエータファイルを参照するアプリケーション:" of type {"APPL"}
  21.                                 set creatorType to creator type of file (the result as string)
  22.                             else if button returned of the result is "OK" then
  23.                                 set creatorType to (text returned of the result)
  24.                                 exit repeat
  25.                             end if
  26.                         end repeat
  27.                         set creator type of repeatList to creatorType
  28.                     else
  29.                         display dialog name of repeatList & "はファイルタイプがTEXTまたはttroではありません。" buttons "OK" default button "OK" with icon 2
  30.                     end if
  31.                 on error errorText number errorNumber
  32.                     if errorNumber ュ -128 then --[-128]のエラーコードはユーザーが「キャンセル」ボタンを押したときである。
  33.                         display dialog "エラーが起きました。[" & errorText & "] (" & errorNumber & ")" buttons "OK" default button "OK" with icon 2
  34.                     end if
  35.                 end try
  36.             else
  37.                 display dialog name of repeatList & "はフォルダのためクリエータタイプを変更することはできません。" buttons "OK" default button "OK" with icon 2
  38.             end if
  39.         end repeat
  40.     end tell
  41. end open